package AC;

import java.util.Scanner;

public class Zifuchuan {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str1 = "This is a good dog";
        System.out.println("输入字符串");
        String str2 = in.next();
        int count = 0;
        for (int i = 0; i < str1.length(); ) {
            int a = str1.indexOf(str2, i);
            i = a + 1;
            if (a == -1) {
                break;
            }
            count++;
        }
        System.out.println(str2 + "在" + str1 + "中出现了" + count + "次");
    }
}
